Example 2: Atomic
This example extends the last one by adding in Organisation details. This demonstrates how to load different record types within the same data file: in this case, both Person and Organisation records will be created using the same data file.
The fields loaded are:
Fields |
Back-end name |
---|---|
First name | NamFirst
|
Middle name | NamMiddle
|
Last name | NamLast
|
Party Type | NamPartyType
|
Organisation | NamOrganisation
|
Department | NamDepartment
|
Street | AddPhysStreet
|
City | AddPhysCity
|
State | AddPhysState
|
Country | AddPhysCountry
|
Zip Code | AddPhysPost
|
Tip: This example also demonstrates how to specify an ampersand character in XML.
For display purposes only, the import data below is presented with column headings listed vertically rather than horizontally. The first row of any tab or comma delimited file must include the column names. The appropriate layout is:
NamPartyType
|
NamFirst
|
NamMiddle
|
NamLast
|
Person | Joe | J | Jackson |
Person | Michael | Williamson | |
Organisation |
The import data is:
Column Name (must appear as the first row of the import data file) |
Record 1 |
Record 2 |
Record 3 |
---|---|---|---|
NamPartyType | Person | Person | Organisation |
NamFirst | Joe | Michael | |
NamMiddle | J | ||
NamLast | Jackson | Williamson | |
NamOrganisation | Seeing Eye Dog School | Accounting & Assoc | "Clocks and Clocks" |
NamDepartment | Income Tax | ||
AddPhysStreet | 2435 Westside Street | Level 23
1214 Hill Street |
|
AddPhysCity | Westside | Eastside | Smithville
|
AddPhysState
|
Central Territory
|
Central Territory
|
Central Territory
|
AddPhysCountry
|
Salsam
|
||
AddPhysPost
|
123 ABC
|
When this data is imported, three records will be created in the Parties module: two will be Person Party Types, the other will be an Organisation Party Type.
The XML for this example is:
<?xml version="1.0" encoding="UTF-8"?>
<table>
<!--First record-->
<tuple>
<atom name="NamPartyType">Person</atom>
<atom name="NamFirst">Joe</atom>
<atom name="NamMiddle">J</atom>
<atom name="NamLast">Jackson</atom>
<atom name="NamOrganisation">Seeing Eye Dog School</atom>
<atom name="AddPhysStreet">2435 Westside Street</atom>
<atom name="AddPhysCity">Westside</atom>
<atom name="AddPhysState">Central Territory</atom>
<atom name="AddPhysCountry">Salsam</atom>
<atom name="AddPhysPost">123 ABC</atom>
</tuple>
<!--Second record-->
<tuple>
<atom name="NamPartyType">Person</atom>
<atom name="NamFirst">Michael</atom>
<atom name="NamLast">Williamson</atom>
<!--Because an ampersand (&) is a special character in XML, it must be specified as & if it is to appear in text. An angled bracket < can also be escaped using < -->
<atom name="NamOrganisation">Accounting & Assoc</atom>
<atom name="NamDepartment">Income Tax</atom>
<atom name="AddPhysStreet">Level 23
1214 Hill Street</atom>
<atom name="AddPhysCity">Eastside</atom>
<atom name="AddPhysState">Central Territory</atom>
</tuple>
<!--Third record-->
<tuple>
<atom name="NamPartyType">Organization</atom>
<atom name="NamOrganisation">"Clocks and Clocks"</atom>
<atom name="AddPhysCity">Smithville</atom>
<atom name="AddPhysState">Central Territory</atom>
</tuple>
</table>